<!DOCTYPE html>
<html>
<head>
    <title>奖学金/牛牛卡 - {$site_info.site_name|default=''}</title>
    <meta name="keywords" content="" />
    <meta name="description" content="">
    <include file="public@head"/>
</head>
<body class="body-white" >
<include file="public@nav" />
<div class="container tc-main">
    <div class="row">
        <div class="col-md-3">
            <include file="public@jiaxiaonav" />
        </div>
        <div class="col-md-9">
            <!--标题 -->
            <div class="personal-nav" style="padding-bottom: 50px;">
                <h2>查看奖学金和牛牛卡</h2>
                <span  class="btncss" style="float:right;" id="tan_card">转赠牛牛卡</span>
                <span  class="btncss" style="float:right;margin-right: 5px;" id="tan_card1">转赠记录</span>
            </div>

            <div class="clear"></div>


            <!--标题 -->
            <div class="personal-class">
                <ul>
                    <if condition="count($data)==0">
                        该学生暂时还没有奖学金和牛牛卡
                        <else/>
                        <foreach name="data" item="vo">
                            <li>
                                <h3>
                                    <if condition="$vo.card_type eq 1">
                                        牛牛卡
                                        <else/>
                                        奖学金
                                    </if>
                                </h3>

                                <dl class="info">
                                    <dd>
                                        <em>卡号：</em>
                                        <if condition="$vo.card_type eq 1">
                                            {$vo.card_number}
                                            <else/>
                                            --
                                        </if>
                                    </dd>
                                    <dd>

                                        <if condition="$vo.card_type eq 1">
                                            <em>家长姓名：</em>
                                            {$realname}
                                            <else/>
                                            <em>学生姓名**学号：</em>
                                              {$student_name}**{$code}
                                        </if>
                                    </dd>
                                    <dd>
                                        <em>金额：</em>
                                        <if condition="$vo.award_money eq 1">
                                          {$vo.award_money}
                                            <else/>
                                            {$vo.award_money}
                                        </if>
                                    </dd>

                                    <dd>

                                        <if condition="empty($vo.valid_date)">
                                            <em>有效时间：</em>
                                            永久有效
                                            <else/>
                                            <em>有效期截止至：</em>
                                            {:date('Y-m-d',$vo.valid_date)}
                                        </if>
                                    </dd>
                                    <dd>
                                        <em>状态：</em>
                                        <if condition="empty($vo.aoid)">
                                            未使用
                                            <else/>
                                            已使用
                                            {:date('Y-m-d ',$vo.aocreate_time)}
                                        </if>
                                    </dd>
                                </dl>
                            </li>
                        </foreach>
                    </if>
                </ul>
                <div class="pagination">{$page|default=''}</div>
            </div>
        </div>
    </div>
</div>

<div id="refund_msg" style="display:none">
    <form action="{:url('jiaxiaotong/jiaXiaoTong/conform_card')}" class="well  row  js-ajax-form margin-top-20" method="post" style="margin:0;">
        <input type="hidden" name="student_id" value="{$student_id}">
        <label class="form-group" >
            选择卡号：
            <select name="card_id" id="card_number1" class="form-control">
                <foreach name="data" id="vo">
                    <option value="{$vo.acid}">{$vo.card_number}</option>
                </foreach>
            </select>
        </label>
        <label class="form-group" for="" id="card_box1">
            手机号
            <input class="form-control" type="number" name="mobile"
                   id="mobile"  value="" placeholder="请输入手机号" >
        </label>
        <label class="form-group" for="" >
            <p class="btn btn-success" id="search_parent">查询</p>
        </label>
        <br>
        <label class="form-group" for="">
            家长姓名:<span class="form-required">*</span>
            <input class="form-control" type="hidden" name="student_id"
                   id="student_id_parent"  value=""  readonly >
            <input class="form-control" type="text"
                   id="student_id_parent1"  value=""  readonly >
        </label>
        <button class="bm js-ajax-submit" type="submit"  id="refund_submit" style="display: none">确定</button>
    </form>
</div>
<!-- /container -->

<div id="refund_msg1" style="display:none;padding:15px;">

    <table class="table table-hover table-bordered table-list">
        <thead>
        <tr>
            <th width="50">卡号</th>
            <th width="100">赠送人</th>
            <th width="120">被赠送者</th>
            <th width="100">赠送时间</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="data_record" item="vo">
          <tr>
              <td>
                  {$vo.card_number}
              </td>
              <td>
                  {$vo.song_person1}
              </td>
              <td>
                  {$vo.accept_person1}
              </td>
              <td>
                  {:date('Y-m-d ',$vo.created_time)}
              </td>
          </tr>
            </foreach>
        </tbody>
        <div class="pagination">{$page1|default=''}</div>
        </table>

</div>

<include file="public@footer" />
<include file="public@scripts" />

</body>
<script type="text/javascript">
    $("body").on('click','#tan_card',function() {
        layer.open({
            type: 1,
            btn: ['提交'],
            title: '转赠牛牛卡',
            content: $('#refund_msg'),
            yes: function (index, layero) {
                $('#refund_submit').click();
            }
        })
    })
    //查询家长
    $("body").on("click",'#search_parent',function(){
        mobile=$("#mobile").val();
        if(mobile==''){return false;}
        //助学金的动态
        $.ajax({
            url: "{:url('jiaxiaotong/JiaXiaoTong/ajax_user')}",
            type: 'get',
            data: {'mobile': mobile},
            success: function (data) {
                data1 = jQuery.parseJSON(data);
                console.log(data1);
                if(data1.realname)
                {
                    $("#student_id_parent").val(data1.id);
                    realname=data1.realname;
                    length=realname.length;
                    if(length>2)
                    {
                        first=realname.substr(0,2);
                        end=realname.substr(2);
                        end=end.replace(/([\u4e00-\u9fa5]|[A-Za-z0-9])/g,'*');
                        realname=first+end;
                    }else{
                        first=realname.substr(0,1);
                        end=realname.substr(1);
                        end=end.replace(/([\u4e00-\u9fa5]|[A-Za-z0-9])/g,'*');
                        realname=first+end;
                    }
                    $("#student_id_parent1").val(realname);

                }
            }
        })
    })
//转赠记录
    $("body").on('click','#tan_card1',function() {
        layer.open({
            type: 1,
            btn: ['关闭'],
            title: '转赠记录',
            content: $('#refund_msg1'),
        })
    })
</script>
</html>